/**
 * 
 */
package browser;

import java.awt.Color;
import java.awt.Component;

import javax.swing.JTable;
import javax.swing.table.DefaultTableCellRenderer;
import javax.swing.table.TableCellRenderer;

/**
 * @author xan
 *
 */
public class WhiteGrayRenderer implements TableCellRenderer {
	
	private DefaultTableCellRenderer defaultRenderer;
	
	public WhiteGrayRenderer()
	{
		defaultRenderer = new DefaultTableCellRenderer();
	}
	
	
	public Component getTableCellRendererComponent(JTable table, Object value,
			boolean isSelected, boolean hasFocus, int row, int column) {

		Component ret = defaultRenderer.getTableCellRendererComponent(table, value, isSelected, hasFocus, row, column);
		
		if(isSelected)
		{
			ret.setBackground(Color.BLUE);
			return ret;
		}
		
		
		if((row % 2) == 0)
			ret.setBackground(Color.WHITE);
		else
			ret.setBackground(new Color(220, 220, 220));
		
		return ret;
	}

}
